package com.eastfair.auth.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.auth.enumeration.OrganizationOrgTypeEnum;
import com.eastfair.auth.enumeration.OrganizationVestTypeEnum;
import com.eastfair.auth.enumeration.ResourceOrganizationResourceTypeEnum;
import com.eastfair.model.DataIsolationVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author ligang
 * @since 2021-07-19
 */
@Data
@ApiModel(value = "OrganizationSaveDTO", description = "")
public class OrganizationDTO implements Serializable {
    //校验标识
    public interface VerifyCreateOrgGroup {}
    public interface VerifyUpdOrgGroup {}


    public interface createBusNode {}
    public interface addCompanyByProject {}
    public interface updCompanyByProject {}

    public interface graftCompanyAdminUser {}
    public interface addUserOfAudience {}
    public interface addHostByProject {}
    public interface breakUseridOfCompany {}

    public interface addUseridOfCompany {}
    public interface updUseridOfCompany {}

    public interface createExhibition {}
    public interface addCompanyExhibition {}
    public interface removeCompany {}


    public interface queryResource {}
    public interface createResource {}
    public interface delResource {}
    public interface addUserOfResource {}
    public interface breakUserOfResource {}

    public interface VerifyGlobalCreateOrgGroup {}
    public interface VerifyGlobalUpdOrgGroup {}

    public interface findAllOrgOfTypeToLead {}

    private static final long serialVersionUID = 1L;

    /**
     * 组织名称
     */
    @ApiModelProperty(value = "组织名称")
    @Size(max = 255, message = "组织名称长度不能超过255")
    @NotBlank(groups = {VerifyCreateOrgGroup.class,createBusNode.class,addCompanyByProject.class,addHostByProject.class,createExhibition.class,addCompanyExhibition.class,updCompanyByProject.class,VerifyUpdOrgGroup.class,createResource.class,VerifyGlobalCreateOrgGroup.class,VerifyGlobalUpdOrgGroup.class})
    private String name;

    /**
     * 组织类型#{project:项目;p_exhibitor_classify:项目下的展商分类;p_sponsor_classify:项目下的主办分类;p_audience_classify:项目下的观众分类;p_builder_classify:项目下的搭建商分类;p_court_classify:项目下的主场分类;p_transport_classify:项目下的主运分类;p_booking_classify:项目下的场馆内部分类;exhibition:展会;e_exhibitor_classify:展会下的展商分类;e_sponsor_classify:展会下的主办;e_audience_classify:展会下的观众分类;e_builder_classify:展会下的搭建商分类;e_court_classify:展会下的主场分类;e_transport_classify:展会下的主运分类;e_booking_classify:展会下的场馆内部分类;exhibitor:展商;sponsor:主办;builder:搭建商;court:主场;transport:主运;booking:场馆内部;staff:用户;other:其他-枚举
     */
    @ApiModelProperty(value = "组织类型#{project:项目;p_exhibitor_classify:项目下的展商分类;p_sponsor_classify:项目下的主办分类;p_audience_classify:项目下的观众分类;p_builder_classify:项目下的搭建商分类;p_court_classify:项目下的主场分类;p_transport_classify:项目下的主运分类;p_booking_classify:项目下的场馆内部分类;exhibition:展会;e_exhibitor_classify:展会下的展商分类;e_sponsor_classify:展会下的主办;e_audience_classify:展会下的观众分类;e_builder_classify:展会下的搭建商分类;e_court_classify:展会下的主场分类;e_transport_classify:展会下的主运分类;e_booking_classify:展会下的场馆内部分类;exhibitor:展商;sponsor:主办;builder:搭建商;court:主场;transport:主运;booking:场馆内部;staff:用户;other:其他-枚举")
    @NotNull(groups = {VerifyCreateOrgGroup.class,createExhibition.class,VerifyGlobalCreateOrgGroup.class})
    private OrganizationOrgTypeEnum orgType;
    /**
     * 组织code码
     */
    @ApiModelProperty(value = "组织code码")
    @Size(max = 255, message = "组织code码长度不能超过255")
    private String code;

    /**
     * 组织id
     */
    @ApiModelProperty(value = "组织id")
    @NotNull(groups = {graftCompanyAdminUser.class,VerifyUpdOrgGroup.class,VerifyGlobalUpdOrgGroup.class}, message = "组织id不能为空")
    private Long orgId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @NotNull(groups = {VerifyGlobalCreateOrgGroup.class,VerifyGlobalUpdOrgGroup.class,findAllOrgOfTypeToLead.class})
    private Long subsystemId;
    /**
     * 资源id
     */
    @ApiModelProperty(value = "资源id")
    @NotNull(groups = {createBusNode.class,addCompanyByProject.class,graftCompanyAdminUser.class,addHostByProject.class,
            breakUseridOfCompany.class,addUseridOfCompany.class,updUseridOfCompany.class,createExhibition.class,
            addCompanyExhibition.class,removeCompany.class,updCompanyByProject.class,queryResource.class,createResource.class,delResource.class})
    private Long resourceId;
    /**
     * 华为同步机构id
     */
    @ApiModelProperty(value = "华为同步机构id")
    private String huaweiOrgId;

    /**
     * 目标资源id
     */
    @ApiModelProperty(value = "目标资源id")
    @NotNull(groups = {addCompanyExhibition.class})
    private Long targetResourceId;


    @ApiModelProperty(value = "资源类型 #{project:项目;company:公司;e_sponsor:展会;other:其他}")
    @NotNull(groups = {createExhibition.class,createResource.class})
    private ResourceOrganizationResourceTypeEnum resourceType;

    @ApiModelProperty(value = "用户id集合")
    @NotNull(groups = {addCompanyByProject.class,addHostByProject.class,addUseridOfCompany.class,addUserOfResource.class,breakUserOfResource.class})
    private List<Long> userIds;

    @Excel(name = "父级id")
    @NotNull(groups = {VerifyCreateOrgGroup.class,VerifyGlobalCreateOrgGroup.class})
    private Long parentId;

    @ApiModelProperty(value = "用户id")
    @NotNull(groups = {updUseridOfCompany.class})
    private Long userId;

    /**
     * 组织id集合
     */
    @ApiModelProperty(value = "组织id集合")
    private List<Long> orgIds;

    /**
     * 角色id集合
     */
    @ApiModelProperty(value = "角色id集合")
    @NotEmpty(groups = {})
    private List<Long> roleIds;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    @ApiModelProperty(value = "组织类型#{PROJECT:项目;P_EXHIBITOR_CLASSIFY:项目下的展商分类;P_SPONSOR_CLASSIFY:项目下的主办分类;P_AUDIENCE_CLASSIFY:项目下的观众分类;P_BUILDER_CLASSIFY:项目下的搭建商分类;P_COURT_CLASSIFY:项目下的主场分类;P_TRANSPORT_CLASSIFY:项目下的主运分类;P_BOOKING_CLASSIFY:项目下的场馆内部分类;EXHIBITION:展会;E_EXHIBITOR_CLASSIFY:展会下的展商分类;E_SPONSOR_CLASSIFY:展会下的主办;E_AUDIENCE_CLASSIFY:展会下的观众分类;E_BUILDER_CLASSIFY:展会下的搭建商分类;E_COURT_CLASSIFY:展会下的主场分类;E_TRANSPORT_CLASSIFY:展会下的主运分类;E_BOOKING_CLASSIFY:展会下的场馆内部分类;EXHIBITOR:展商;SPONSOR:主办;BUILDER:搭建商;COURT:主场;TRANSPORT:主运;BOOKING:场馆内部;STAFF:用户;OTHER:其他-枚举")
    private List<OrganizationOrgTypeEnum> orgTypeList;

    /**
     * 组织code码集合
     */
    @ApiModelProperty(value = "组织code码")
    @Size(max = 255, message = "组织code码长度不能超过255")
    private List<String> codes;

    /**
     * 组织类型归属#{P:项目;R:资源;E:展会;}
     */
    @ApiModelProperty(value = "组织类型归属#{P:项目;R:资源;E:展会;}")
    private OrganizationVestTypeEnum vestType;


    /**
     * 是否管理员 1是0否
     */
    @ApiModelProperty(value = "是否管理员 1是0否")
    @NotNull(groups = {addUserOfResource.class})
    private Integer isAdmin;
    /**
     * 团队ID
     */
    @ApiModelProperty(value = "团队ID")
    private Long teamId;

    /**
     * 子系统集合
     */
    private List<DataIsolationVo> subsystemList;

    /**
     * 是否是负责人
     */
    @ApiModelProperty(value = "是否是负责人")
    private Integer isLeader;


}
